package com.jinghang.scala_base._2_Scala模式匹配

import java.io.{File, PrintWriter}

object ExceptionApp extends App {




  val writer = new PrintWriter(new File("data/test.txt" ))
  writer.write("001")
  writer.flush()

  try{

    // open file
    // use file

    val i = 10/0
    println(i)
  } catch {
    case e:ArithmeticException => println("除数不能为0..")
    case e:Exception => println(e.getMessage)
  } finally {

    // 释放资源，一定能执行: close file

  }




}
